package com.engine.modules.ytht.controller;

import com.engine.common.baseEntity.ResponseEntity.ResponseMsg;
import com.engine.modules.ytht.entity.ContractEntity;
import com.engine.modules.ytht.entity.FarmersFieldsEntity;
import com.engine.modules.ytht.mapper.ContractMapper;
import com.engine.modules.ytht.mapper.FarmersBindingMapper;
import com.engine.modules.ytht.service.ContractServiceImpl;
import com.engine.modules.ytht.service.FarmersFieldBindingImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiSort;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author HX
 * @version 1.0.0
 * @ClassName ContractMapper.java
 * @Description TODO
 * @createTime 2022年2月16日
 */
@RestController
@Api(tags = "2、合同相关操作")
@ApiSort(value = 3)
@CrossOrigin
@RequestMapping("/Contract")
@Slf4j
public class ContractController {

    @Autowired
    ContractServiceImpl contractServiceImpl;

    @ApiOperation(value = "通过地块编号查询合同内容", notes = "通过地块编号查询合同内容")
    @GetMapping(value = "/GetContractByFieldBlockId/{fbId}")
    @ApiOperationSupport(order = 3)
    public ResponseMsg GetContractByFieldBlockId(@PathVariable String fbId) {
        try {
            List<ContractEntity> rs= contractServiceImpl.getContractByFieldBlockId(fbId);
            return ResponseMsg.success("查询成功").addData(rs);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            return ResponseMsg.error(e.getMessage());
        }
    }

}
